import React from 'react'
import {Card,Form,Icon,Input,Button,Checkbox } from 'antd'
import './../ui/index.less'
const FormItem = Form.Item;
class formLogin extends React.Component{
    handleSubmit = (e) => {
        e.preventDefault();
        this.props.form.validateFields((err, values) => {
            if (!err) {
                console.log('Received values of form: ', values);
            }
        });
    }
    render(){
        const { getFieldDecorator } = this.props.form;
        return(
            <div>
               <Card title='登录框一' className='card-wrap'>
                   <Form layout="inline" >
                       <FormItem>
                       <Input prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="Username" />
                       </FormItem>
                       <FormItem>
                           <Input prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} type="password" placeholder="Password" />
                       </FormItem>
                       <FormItem>
                           <Button
                               type="primary"
                               htmlType="submit"
                           >
                              登录
                           </Button>
                       </FormItem>
                   </Form>
               </Card>
                <Card title='登录表单二' style={{marginTop:10}}>
                    <Form layout='horizontal' onSubmit={this.handleSubmit} style={{width:300}}>
                        <FormItem>
                            {getFieldDecorator('userName', {
                                rules: [{ required: true, message: 'Please input your username!' }],
                            })(
                                <Input prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="Username" />
                            )}
                        </FormItem>
                        <FormItem>
                            {getFieldDecorator('password', {
                                rules: [{ required: true, message: 'Please input your Password!' }],
                            })(
                                <Input prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} type="password" placeholder="Password" />
                            )}
                        </FormItem>
                        <FormItem>
                            {getFieldDecorator('remember', {
                                valuePropName: 'checked',
                                initialValue: true,
                            })(
                                <Checkbox>Remember me</Checkbox>
                            )}
                            <Button type="primary" htmlType="submit" className="login-form-button">
                                Log in
                            </Button>
                        </FormItem>
                    </Form>
                </Card>
           </div>
        )
    }
}
export default Form.create()(formLogin);